package ch.bfh.mobicomp.soda2.wifi;

import ch.bfh.mobicomp.soda2.wifi.service.WifiService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.sax.StartElementListener;

public class WifiBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
    	if(intent != null) {
    		String action = intent.getAction();
    		
    		if(action.equals(WifiService.ACTION_AP)) {
    			intent.setClass(context, WifiService.class);
    			context.startService(intent);
    		}
    		else if(action.equals(WifiService.ACTION_START)) {
    			intent.setClass(context, WifiService.class);
    			context.startService(intent);
    		}
    		else if(action.equals("android.intent.action.BOOT_COMPLETED")) {
    			Intent startIntent = new Intent(context, WifiService.class);
    			context.startService(startIntent);
    		}
    	}
    }

}